#!/usr/bin/python
#-*- coding: UTF-8 -*-
from __future__ import unicode_literals
from flask_wtf import FlaskForm
from wtforms import Form
from wtforms import RadioField, SubmitField, StringField, PasswordField,BooleanField,core
from wtforms.validators import DataRequired, Length
from flask import Flask, render_template, request, redirect
import time

#user_id,equipmnet, xinghao,bumen,owner,dispaly,cpu,memory,disk,mac_addr,guzhang,create_time
class TodoListForm(FlaskForm):
    equipmnet = StringField('设备编号', validators=[DataRequired(), Length(1, 256)])
    xinghao = StringField('机型', validators=[DataRequired(), Length(1, 256)])
    bumen = core.SelectField('使用部门',choices=[("行政部", '行政部'),("技术部",'技术部'),("总裁办",'总裁办')])
    owner = StringField('使用者', validators=[DataRequired(), Length(1, 256)])
    dispaly = StringField('配套显示器及个数', validators=[DataRequired(), Length(3, 256)])
    cpu = core.SelectField('cpu型号',choices=[("Inter(R) Xeon(R)CPU E5-2620 v2 @2.10GHz","Inter(R) Xeon(R)CPU E5-2620 v2 @2.10GHz"),("Inter(R) Xeon(R)CPU E5-2630 0 @2.3GHz","Inter(R) Xeon(R)CPU E5-2630 0 @2.3GHz")])
    memory = core.SelectField('内存',choices=[("8G", '8G'),("16G",'16G')])
    disk = StringField('硬盘', validators=[DataRequired(), Length(1, 256)])
    mac_addr = StringField('mac地址', validators=[DataRequired(), Length(11,256)])
    #guzhang = RadioField('是否故障', validators=[DataRequired()], choices=[("Y", '是'), ("N", '否')])
    guzhang = core.SelectField('是否故障', choices=[("是", 'Yes'),("否",'No')])
    create_time = core.SelectField('提交时间',choices=[(time.strftime("%Y-%m-%d %X", time.localtime()), '系统时间')])
    submit = SubmitField('提交')


class LoginForm(FlaskForm):
    username = StringField('user:\nyunwei', validators=[DataRequired(), Length(1, 24)])
    password = PasswordField('pass:\n test', validators=[DataRequired(), Length(1, 24)])
    submit = SubmitField('登录')

class TextForm(Form):
    example = core.RadioField('Choice 1:', choices=[('A','Option A'),('B','Option B')])
    key = core.RadioField('Choice 2:', choices=[('1', 'Option 1'), ('2', 'Option 2')])
    submit = SubmitField('Submit')

